package com.nanning.web.controller.nanning;


import com.nanning.common.core.controller.BaseController;
import com.nanning.common.core.domain.AjaxResult;
import com.nanning.common.core.page.TableDataInfo;
import com.nanning.system.domain.ImportRecord;
import com.nanning.system.service.IImportRecordService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 数据导入记录表 前端控制器
 * </p>
 *
 * @author zhurenwang
 * @since 2025-05-07
 */
@RestController
@RequestMapping("/record")
public class ImportRecordController extends BaseController {

    @Autowired
    private IImportRecordService importRecordService;

    @ApiOperation("获取事件录音列表")
    @GetMapping("/list")
    public TableDataInfo list(ImportRecord record) {
        startPage();
        List<ImportRecord> list = importRecordService.list(record);
        return getDataTable(list);
    }

    @ApiOperation("新增事件录音")
    @PostMapping()
    public AjaxResult add(@RequestBody ImportRecord record) {
        return success(importRecordService.add(record));
    }

    @ApiOperation("删除录音")
    @DeleteMapping("/{id}")
    public AjaxResult delete(@PathVariable Integer id) {
        return success(importRecordService.deleteById(id));
    }

    @ApiOperation("获取事件录音详情")
    @GetMapping("/{id}")
    public AjaxResult get(@PathVariable Integer id) {
        return success(importRecordService.getById(id));
    }

    @ApiOperation("修改录音")
    @PutMapping()
    public AjaxResult edit(@RequestBody ImportRecord record) {
        return success(importRecordService.updateById(record));
    }

}
